home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Ghost 1.0 / source / Ghost ƒ / MSG Shell ƒ / msg environment.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.9 KB  |  120 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        msg environment.c
  4.  
  5. Purpose:    This module handles initializing the environment and
  6.             checking for various environmental characteristics.
  7.  
  8.  
  9. Ghost -=- a classic word-building challenge
  10. Copyright (C) 1993 Mark Pilgrim
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "GestaltEqu.h"
  30. #include "Traps.h"
  31. #include "msg environment.h"
  32. #include "msg apple events.h"
  33. #include "msg graphics.h"
  34. #include "msg menus.h"
  35.  
  36. Boolean            gHasPowerManager;
  37. Boolean            gHasAppleEvents;
  38. Boolean            gHasFSSpecs;
  39. Boolean            gStandardFile58;
  40. Boolean            gHasColorQD;
  41.  
  42. Boolean            gInProgress;
  43. Boolean            gDone;
  44.  
  45. Rect            gDragRect;
  46.  
  47. void CheckEnvironment(void)
  48. {
  49.     long    gestalt_temp;
  50.     OSErr    isHuman;
  51.     
  52.     isHuman = Gestalt(gestaltQuickdrawVersion, &gestalt_temp);
  53.     gHasColorQD = !(isHuman || (gestalt_temp < gestalt8BitQD));
  54.     
  55.     GetMainScreenBounds();
  56.     
  57.     isHuman = Gestalt(gestaltFSAttr, &gestalt_temp);
  58.     gHasFSSpecs=((isHuman==noErr) && (gestalt_temp & (1 << gestaltHasFSSpecCalls)));
  59.  
  60.     isHuman = Gestalt(gestaltStandardFileAttr, &gestalt_temp);
  61.     gStandardFile58=((isHuman==noErr) && (gestalt_temp & (1 << gestaltStandardFile58)));
  62.  
  63.     gHasAppleEvents=0;
  64.     isHuman = Gestalt(gestaltAppleEventsAttr, &gestalt_temp);
  65.     if (!isHuman)
  66.     {
  67.         gHasAppleEvents = 1;
  68.         SetUpAppleEvents();
  69.     }
  70. }
  71.  
  72. void InitEnvironment(void)
  73. {
  74.     Handle        MBARHandle;
  75.     
  76.     MBARHandle = GetNewMBar(400);
  77.     SetMenuBar(MBARHandle);
  78.     gAppleMenu = GetMHandle(appleMenu);
  79.     gFileMenu = GetMHandle(fileMenu);
  80.     gEditMenu = GetMHandle(editMenu);
  81.     gOptionsMenu = GetMHandle(optionsMenu);
  82.     
  83.     gHelpMenu = GetMenu(helpMenu);
  84.     InsertMenu(gHelpMenu, -1);
  85.     
  86.     gComputerMenu = GetMenu(computerMenu);
  87.     InsertMenu(gComputerMenu, -1);
  88.     
  89.     gIntelligenceMenu = GetMenu(intelligenceMenu);
  90.     InsertMenu(gIntelligenceMenu, -1);
  91.     
  92.     gSpeedMenu = GetMenu(speedMenu);
  93.     InsertMenu(gSpeedMenu, -1);
  94.     
  95.     gDictionaryMenu = GetMenu(dictionaryMenu);
  96.     InsertMenu(gDictionaryMenu, -1);
  97.     
  98.     AddResMenu(gAppleMenu, 'DRVR');
  99.     
  100.     AdjustMenus();
  101.     DrawMenuBar();
  102.     
  103.     if(gHasColorQD)
  104.     {
  105.         gDragRect = (*GetGrayRgn())->rgnBBox;
  106.     }
  107.     else
  108.     {
  109.         gDragRect = screenBits.bounds;
  110.     }
  111.     
  112.     gDragRect.top += 4;
  113.     gDragRect.left += 4;
  114.     gDragRect.right -= 4;
  115.     gDragRect.bottom -= 4;
  116.     
  117.     gInProgress=FALSE;
  118.     gDone=FALSE;
  119. }
  120.